Inorder traversal of splay trees

نویسنده

  • Colm Ó'Dúnlaing
چکیده

Splay trees, a form of self-adjusting binary tree, were introduced by Sleator and Tarjan in the early 1980s. Their main use is to store ordered lists. The idea is to keep the trees reasonably well balanced through a ‘splay heuristic.’ Sleator and Tarjan showed that if amortised rather than worst-case times are considered, splay trees are optimal. Splay trees have the advantage of simplicity: they are much easier to implement than 2-3 trees, AVL trees, or red-black trees. What if one uses splaying during an inorder traversal of the tree? Sleator and Tarjans’ analysis guarantees O(n log(n)) overall cost. On the other hand, the cost of ordinary inorder traversal is linear, whether or not the tree is balanced. We present some data which suggests that the traversal time is O(n), and demonstrate an O(n log log(n)) upper bound. This upper bound is reached through a rather unusual unbounded-history recurrence and by using weaker bounds, such as the O(n log(n)) bound, along the way.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

A simple bound for sequential access in splay trees

It is known that to traverse a binary tree in inorder, by repeated splay-to-root, uses O(n) rotations. Estimates vary from 15n to 4.5n in proofs of varying length and difficulty. We present a fairly easy estimate of 6n rotations. (1) The process under consideration is inorder traversal of a binary tree using repeated splay-to-root: n is the number of nodes in the tree. Call the operation of see...

متن کامل

Automatic Functional Correctness Proofs for Functional Search Trees

In a new approach, functional correctness specifications of insert/update and delete operations on search trees are expressed on the level of lists by means of an inorder traversal function that projects trees to lists. With the help of a small lemma library, functional correctness and preservation of the search tree property are proved automatically (in Isabelle/HOL) for a range of data struct...

متن کامل

Lecture 4 : BST Introduction and Treaps

1 Binary Search Tree 1.1 Operations We want to design a data structure, an ordered set S that supports the following operations: 1. Search(k, S) 2. Insert(k, S) 3. Delete(k, S) 4. Range(k, k ′ , S) ≡ |{k ∈ S|k ≤ k ≤ k}| If only (1), (2), (3) are required, we could use a hash table. However, if we also need (4), then we will need a BST. Definition 1.1. T is a BST for keys S if: 1. T is an ordere...

متن کامل

Inorder Traversal of a Binary Heap and its Inversion in Optimal Time and Space

In this paper we derive a linear-time, constant-space algorithm to construct a binary heap whose inorder traversal equals a given sequence. We do so in two steps. First, we invert a program that computes the inorder traversal of a binary heap, using the proof rules for program inversion by W. Chen and J.T. Udding. This results in a linear-time solution in terms of binary trees. Subsequently, we...

متن کامل

The Number of Descendants in Simply Generated Random Trees

The aim of this note is to generalize some recent results for binary trees by Panholzer and Prodinger [15] to a larger class of rooted trees. The number of descendants of a node j is the number of nodes in the subtree rooted at j, and the number of ascendants is the number of nodes between j and the root. Recently, Panholzer and Prodinger [15] studied the behavior of these parameters in binary ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • Electr. Notes Theor. Comput. Sci.

دوره 74  شماره 

صفحات  -

تاریخ انتشار 2002